package cn.iocoder.yudao.module.agent.dal.mysql.brokerageclue;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.agent.dal.dataobject.brokerageclue.AgentBrokerageClueDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.agent.controller.admin.brokerageclue.vo.*;

/**
 * 代理人分销用户线索 Mapper
 *
 * @author 曹建伟
 */
@Mapper
public interface AgentBrokerageClueMapper extends BaseMapperX<AgentBrokerageClueDO> {

    default PageResult<AgentBrokerageClueDO> selectPage(AgentBrokerageCluePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AgentBrokerageClueDO>()
                .eqIfPresent(AgentBrokerageClueDO::getMemberId, reqVO.getMemberId())
                .eqIfPresent(AgentBrokerageClueDO::getWxAccount, reqVO.getWxAccount())
                .betweenIfPresent(AgentBrokerageClueDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AgentBrokerageClueDO::getId));
    }

    default List<AgentBrokerageClueDO> selectList(AgentBrokerageClueExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<AgentBrokerageClueDO>()
                .eqIfPresent(AgentBrokerageClueDO::getWxAccount, reqVO.getWxAccount())
                .betweenIfPresent(AgentBrokerageClueDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AgentBrokerageClueDO::getId));
    }

}
